#!/usr/bin/env node
import { getCode } from './getCode.mjs'
import { writeFileSync } from 'fs'

const targetDir = process.argv[2]

if (!targetDir) throw new Error('路径不能为空')

const data = getCode(targetDir, {
    log: true,
})

const filename = Date.now() + '.txt'
writeFileSync(filename, data.code)

console.log('总行数：' + data.line)
console.log('合并后的代码已保存到：' + filename)